<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <title>115-高档的Switch开关样式</title>
    <style>
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background: #111;
        flex-direction: column;
      }

      input[type='radio'] {
        position: relative;
        width: 120px;
        height: 40px;
        margin: 10px;
        outline: none;
        background: #111;
        -webkit-appearance: none;
        cursor: pointer;
        border-radius: 20px;
        box-shadow: -5px -5px 20px rgba(255, 255, 255, 0.1), 5px 5px 10px rgba(0, 0, 0, 1),
          inset -2px -2px 5px rgba(255, 255, 255, 0.1), inset 2px 2px 5px rgba(0, 0, 0, 0.5), 0 0 0 2px #1f1f1f;
        transition: 0.5s;
      }

      input[type='radio']:checked {
        background: #20b7ff;
      }

      input[type='radio']::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 80px;
        height: 40px;
        background: linear-gradient(to top, #000, #555);
        border-radius: 20px;
        box-shadow: 0 0 0 1px #232323;
        transform: scale(0.98, 0.96);
        transition: 0.5s;
      }

      input[type='radio']:checked::before {
        left: 40px;
      }

      input[type='radio']::after {
        content: '';
        position: absolute;
        left: 65px;
        top: calc(50% - 2px);
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: #555;
        transition: 0.5s;
      }

      input[type='radio']:checked::after {
        left: calc(65px + 40px);
        background: #63cdff;
        box-shadow: 0 0 5px #63cdff, 0 0 15px #63cdff, 0 0 30px #63cdff;
      }
    </style>
  </head>

  <body>
    <label><input type="radio" name="btn" /></label>
    <label><input type="radio" name="btn" /></label>
  </body>
</html>
